\(\int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx\) [167]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 52 \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {2 i \cos ^3(c+d x)}{3 a^2 d}+\frac {\sin (c+d x)}{a^2 d}-\frac {2 \sin ^3(c+d x)}{3 a^2 d} \]

[Out]

2/3*I*cos(d*x+c)^3/a^2/d+sin(d*x+c)/a^2/d-2/3*sin(d*x+c)^3/a^2/d

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {3171, 3169, 2713, 2645, 30, 2644} \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=-\frac {2 \sin ^3(c+d x)}{3 a^2 d}+\frac {\sin (c+d x)}{a^2 d}+\frac {2 i \cos ^3(c+d x)}{3 a^2 d} \]

[In]

Int[Cos[c + d*x]/(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2,x]

[Out]

(((2*I)/3)*Cos[c + d*x]^3)/(a^2*d) + Sin[c + d*x]/(a^2*d) - (2*Sin[c + d*x]^3)/(3*a^2*d)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2644

Int[cos[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(a*f), Subst[Int[
x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Sin[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] &&
 !(IntegerQ[(m - 1)/2] && LtQ[0, m, n])

Rule 2645

Int[(cos[(e_.) + (f_.)*(x_)]*(a_.))^(m_.)*sin[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-(a*f)^(-1), Subst[
Int[x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Cos[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2]
 &&  !(IntegerQ[(m - 1)/2] && GtQ[m, 0] && LeQ[m, n])

Rule 2713

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rule 3169

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[cos[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rule 3171

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symb
ol] :> Dist[a^n*b^n, Int[Cos[c + d*x]^m/(b*Cos[c + d*x] + a*Sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, m},
x] && EqQ[a^2 + b^2, 0] && ILtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {\int \cos (c+d x) (i a \cos (c+d x)+a \sin (c+d x))^2 \, dx}{a^4} \\ & = -\frac {\int \left (-a^2 \cos ^3(c+d x)+2 i a^2 \cos ^2(c+d x) \sin (c+d x)+a^2 \cos (c+d x) \sin ^2(c+d x)\right ) \, dx}{a^4} \\ & = -\frac {(2 i) \int \cos ^2(c+d x) \sin (c+d x) \, dx}{a^2}+\frac {\int \cos ^3(c+d x) \, dx}{a^2}-\frac {\int \cos (c+d x) \sin ^2(c+d x) \, dx}{a^2} \\ & = \frac {(2 i) \text {Subst}\left (\int x^2 \, dx,x,\cos (c+d x)\right )}{a^2 d}-\frac {\text {Subst}\left (\int x^2 \, dx,x,\sin (c+d x)\right )}{a^2 d}-\frac {\text {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{a^2 d} \\ & = \frac {2 i \cos ^3(c+d x)}{3 a^2 d}+\frac {\sin (c+d x)}{a^2 d}-\frac {2 \sin ^3(c+d x)}{3 a^2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.45 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.40 \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {i \cos (c+d x)}{2 a^2 d}+\frac {i \cos (3 (c+d x))}{6 a^2 d}+\frac {\sin (c+d x)}{2 a^2 d}+\frac {\sin (3 (c+d x))}{6 a^2 d} \]

[In]

Integrate[Cos[c + d*x]/(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2,x]

[Out]

((I/2)*Cos[c + d*x])/(a^2*d) + ((I/6)*Cos[3*(c + d*x)])/(a^2*d) + Sin[c + d*x]/(2*a^2*d) + Sin[3*(c + d*x)]/(6
*a^2*d)

Maple [A] (verified)

Time = 0.53 (sec) , antiderivative size = 38, normalized size of antiderivative = 0.73

method result size
risch \(\frac {i {\mathrm e}^{-i \left (d x +c \right )}}{2 a^{2} d}+\frac {i {\mathrm e}^{-3 i \left (d x +c \right )}}{6 a^{2} d}\) \(38\)
derivativedivides \(\frac {\frac {2 i}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-i\right )^{2}}-\frac {4}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-i\right )^{3}}+\frac {2}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-i}}{a^{2} d}\) \(57\)
default \(\frac {\frac {2 i}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-i\right )^{2}}-\frac {4}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-i\right )^{3}}+\frac {2}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-i}}{a^{2} d}\) \(57\)
norman \(\frac {\frac {4 i \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{a d}+\frac {4 i}{3 a d}+\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {4 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 a d}+\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}}{a \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{3}}\) \(105\)

[In]

int(cos(d*x+c)/(cos(d*x+c)*a+I*a*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*I/a^2/d*exp(-I*(d*x+c))+1/6*I/a^2/d*exp(-3*I*(d*x+c))

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 30, normalized size of antiderivative = 0.58 \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {{\left (3 i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i\right )} e^{\left (-3 i \, d x - 3 i \, c\right )}}{6 \, a^{2} d} \]

[In]

integrate(cos(d*x+c)/(a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

1/6*(3*I*e^(2*I*d*x + 2*I*c) + I)*e^(-3*I*d*x - 3*I*c)/(a^2*d)

Sympy [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.77 \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\begin {cases} \frac {\left (6 i a^{2} d e^{3 i c} e^{- i d x} + 2 i a^{2} d e^{i c} e^{- 3 i d x}\right ) e^{- 4 i c}}{12 a^{4} d^{2}} & \text {for}\: a^{4} d^{2} e^{4 i c} \neq 0 \\\frac {x \left (e^{2 i c} + 1\right ) e^{- 3 i c}}{2 a^{2}} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)/(a*cos(d*x+c)+I*a*sin(d*x+c))**2,x)

[Out]

Piecewise(((6*I*a**2*d*exp(3*I*c)*exp(-I*d*x) + 2*I*a**2*d*exp(I*c)*exp(-3*I*d*x))*exp(-4*I*c)/(12*a**4*d**2),
 Ne(a**4*d**2*exp(4*I*c), 0)), (x*(exp(2*I*c) + 1)*exp(-3*I*c)/(2*a**2), True))

Maxima [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 45, normalized size of antiderivative = 0.87 \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {i \, \cos \left (3 \, d x + 3 \, c\right ) + 3 i \, \cos \left (d x + c\right ) + \sin \left (3 \, d x + 3 \, c\right ) + 3 \, \sin \left (d x + c\right )}{6 \, a^{2} d} \]

[In]

integrate(cos(d*x+c)/(a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

1/6*(I*cos(3*d*x + 3*c) + 3*I*cos(d*x + c) + sin(3*d*x + 3*c) + 3*sin(d*x + c))/(a^2*d)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.90 \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {2 \, {\left (3 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 i \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2\right )}}{3 \, a^{2} d {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - i\right )}^{3}} \]

[In]

integrate(cos(d*x+c)/(a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="giac")

[Out]

2/3*(3*tan(1/2*d*x + 1/2*c)^2 - 3*I*tan(1/2*d*x + 1/2*c) - 2)/(a^2*d*(tan(1/2*d*x + 1/2*c) - I)^3)

Mupad [B] (verification not implemented)

Time = 22.73 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.52 \[ \int \frac {\cos (c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=-\frac {2\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,3{}\mathrm {i}+3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-2{}\mathrm {i}\right )}{3\,a^2\,d\,\left (-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,1{}\mathrm {i}-3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,3{}\mathrm {i}+1\right )} \]

[In]

int(cos(c + d*x)/(a*cos(c + d*x) + a*sin(c + d*x)*1i)^2,x)

[Out]

-(2*(3*tan(c/2 + (d*x)/2) + tan(c/2 + (d*x)/2)^2*3i - 2i))/(3*a^2*d*(tan(c/2 + (d*x)/2)*3i - 3*tan(c/2 + (d*x)
/2)^2 - tan(c/2 + (d*x)/2)^3*1i + 1))